package com.lineage.data.item_etcitem.teleport;

import com.lineage.data.executor.ItemExecutor;
import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.serverpackets.S_NPCTalkReturn;
import com.lineage.server.serverpackets.S_ServerMessage;
import com.lineage.server.serverpackets.ServerBasePacket;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class NewOM_TeleportRune_Phantom extends ItemExecutor {
  private static final Log _log = LogFactory.getLog(NewOM_TeleportRune_Phantom.class);
  
  public static ItemExecutor get() {
    return new NewOM_TeleportRune_Phantom();
  }
  
  public void execute(int[] data, L1PcInstance pc, L1ItemInstance item) {
    try {
      if (pc.hasSkillEffect(4017)) {
        pc.sendPackets((ServerBasePacket)new S_ServerMessage(1413));
        return;
      } 
      pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "telBook4"));
      if (!pc.isPhantomTeleport())
        pc.setPhantomTeleport(true); 
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
}
